<?php

namespace App\Http\Controllers\Admin\CommissionReturn;

use App\Http\Controllers\Controller as BaseController;
use App\Repository\CommissionReturn\CommissionReturnLogsRepository;
use Illuminate\Http\Request;

// 主播
class LogsController extends BaseController
{
    private $repoist;

    public function __construct(CommissionReturnLogsRepository $repository)
    {
        $this->repoist = $repository;
    }


    public function index(Request $request)
    {
        $dataArr = $this->repoist->index($request->all(), $request->get('pageNum'), $request->get('pageSize'));
        if (is_array($dataArr) && $request->get('pageNum') == 1) {
            $dataArr['isOnlineStatusList'] = config('card.isOnlineStatus');
        }
        return $dataArr;
    }


    public function edit(Request $request)
    {
        if (!$request->get('id')) {
            return $this->returnMsg(1, '请传递id参数');
        }
        return $this->repoist->edit($request->all());
    }


    public function del(Request $request, $id)
    {
        if (!$id) {
            return $this->returnMsg(1, '请传递参数');
        }
        return $this->repoist->unifiedDel($id);
    }
}
